namespace Common
{
    using System;
    using System.Collections;
    using System.Security.Principal;
    using System.Web;
    using System.Web.Caching;
    using System.Web.Profile;
    using System.Web.SessionState;

    /// <summary>
    /// Interface used to wrap the <see cref="System.Web.HttpContext"/> class.
    /// </summary>
    /// <remarks>The goal of this interface is to improve testability.</remarks>
    public interface IHttpContext
    {
        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        Exception[] AllErrors { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        HttpApplicationState Application { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        HttpApplication ApplicationInstance { get; set; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        Cache Cache { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        IHttpHandler CurrentHandler { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        Exception Error { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        IHttpHandler Handler { get; set; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        bool IsCustomErrorEnabled { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        bool IsDebuggingEnabled { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        IDictionary Items { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        IHttpHandler PreviousHandler { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        ProfileBase Profile { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        HttpRequest Request { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        HttpResponse Response { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        IHttpSessionState Session { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        bool SkipAuthorization { get; set; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        DateTime Timestamp { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        TraceContext Trace { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        IPrincipal User { get; set; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        System.Web.HttpContext Context { get; }

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        void AddError(Exception errorInfo);

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        void ClearError();

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        object GetSection(string sectionName);

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        void RewritePath(string filePath, string pathInfo, string queryString, bool setClientFilePath);

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        void RewritePath(string filePath, string pathInfo, string queryString);

        /// <summary>
        /// See <see cref="System.Web.HttpContext"/> for a description.
        /// </summary>
        void RewritePath(string path, bool rebaseClientPath);
    }
}